package come.bjpowernode.javase.io;

import java.io.File;
import java.io.IOException;
import java.lang.reflect.Field;

public class FileTest05 {
    public static void main(String[] args) {
        String fileDir = "/fileDir";
        String fileName = "sun.txt";
        File file = new File(fileDir);

        //如果不先创建文件夹，会报错：找不到指定的路径
        if (!file.isDirectory()){
            file.mkdirs();
        }
        File file1 = new File(fileDir + "/" + fileName);
        if (!file1.exists()){
            try {
                file1.createNewFile();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

        if (file1.exists()){
            file1.delete();
        }
    }
}
